<template>
  <el-menu theme="dark" :default-active="activeIndex" class="el-menu-demo nav" mode="horizontal" @select="handleSelect">
    <el-menu-item index="1"><h2>信息发布后台系统</h2></el-menu-item>
    <el-menu-item index="3" class="user" style="float:right;">
      <div>当前用户</div>
      <div>{{user}}</div>
    </el-menu-item>
  </el-menu>
</template>

<script>
  export default {
    data() {
      return {
        activeIndex: '1',
        activeIndex2: '1',
        user:this.$store.state.user.userName,
      };
    },
    methods: {
      handleSelect(key, keyPath) {
        console.log(key, keyPath);
      }
    }
  }
</script>
<style>
  .nav{
    width: 100%;
    height: 60px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
  }
  .user{
    float:right;
  }
  .user div{
    float:left;
    padding-left: 10px;
  }
</style>
